package minidb.test;

import java.io.*;
import minidb.parse.sym;
import minidb.parse.exps.*;

public class Wangurey
{

	
	public static void main(String[] args) throws IOException, ClassNotFoundException
	{
		ByteArrayOutputStream bos=new ByteArrayOutputStream();
		ObjectOutputStream oos=new ObjectOutputStream(bos);
		
				
		OperandInt i1=new OperandInt(10);
		OperandInt i2=new OperandInt(20);
		OperandString s1=new OperandString("wangurey1");
		OperandString s2=new OperandString("wangurey2");
		OperandNull n1=new OperandNull();
		OperandDouble d1=new OperandDouble(10.0);
		OperandDouble d2=new OperandDouble(20.0);
		
		
		Predicate p1=new Predicate(sym.EQ, i1, d2);
		Predicate p2=new Predicate(sym.GT, s1, s2);
		Predicate p3=new Predicate(sym.IS, d1, n1);
		
		Condition c1=new Condition(p1);
		Condition c2=new Condition(p2);
		Condition c3=new Condition(p3);
		
		Condition c12=new Condition(sym.OR,c1,c2);
		Condition c123=new Condition(sym.AND,c3,c12);
		Condition c123_2=c123.DupCondition();
		Condition cout=new Condition(sym.AND,c123,c123_2);
		System.out.println(cout.Print());
		
		
		System.out.println(bos.size());
		oos.writeObject(cout);
		System.out.println(bos.size());
		
		
		ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
		ObjectInputStream ois=new ObjectInputStream(bis);
		
		Condition cin=(Condition)ois.readObject();
		System.out.println(cin.Print());

	}

}
